//头文件

#include "behaviortree_cpp/behavior_tree.h"
#include "behaviortree_cpp/bt_factory.h"
#include <iostream>
namespace mynode
{
    using BT::NodeStatus;
    //行为树节点类

    //mySleep叶节点
    class mySleep : public BT::SyncActionNode
    {
        public:
            mySleep(const std::string& name, const BT::NodeConfig& config) :
            BT::SyncActionNode(name, config)
            {
            }
            // 给该节点申明端口
            static BT::PortsList providedPorts()
            {
                return { 
                    //端口设置
                };
            }
            BT::NodeStatus tick() override
            {
                //实现功能
                //setOutput("端口名称","设置端口输出值");
                //getInput("端口名称",端口输入值);
                std::cout<<"mySleep!!!"<<std::endl;
                std::cout<<std::endl;
                std::cout<<std::endl;
                return BT::NodeStatus::SUCCESS;
            }
    };



    //Rested叶节点
    class Rested : public BT::SyncActionNode
    {
        public:
            Rested(const std::string& name, const BT::NodeConfig& config) :
            BT::SyncActionNode(name, config)
            {
            }
            // 给该节点申明端口
            static BT::PortsList providedPorts()
            {
                return { 
                    //端口设置
                        BT::InputPort<std::string>("are"),
                };
            }
            BT::NodeStatus tick() override
            {
                //实现功能dafdfaf
                //setOutput("端口名称","设置端口输出值");sgfdsgewtge
                //getInput("端口名称",端口输入值);sgdasgasg
                std::cout<<"Rested!!!"<<std::endl;
                return BT::NodeStatus::FAILURE;
            }
    };


    
    inline void RegisterNodes(BT::BehaviorTreeFactory& factory)
    {
        //注册节点
factory.registerNodeType<mySleep>("mySleep");

factory.registerNodeType<Rested>("Rested");


    }
}